<%@page contentType="text/html" pageEncoding="UTF-8" import="java.sql.*"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Student Connect</title>
    </head>
    <h2>Connection Page:</h2>
    <body>
        <%
        try
          { String name = request.getParameter("s_name");
            String branch = request.getParameter("s_branch");
            String sam = request.getParameter("s_sem");
            String rollno = request.getParameter("s_rollno");
            out.println(name);out.println("</br>");
            out.println(branch);out.println("</br>");
            out.println(sam);out.println("</br>");
            out.println(rollno);out.println("</br>");
            
            
            Class.forName("com.mysql.jdbc.Driver");
            String url="jdbc:mysql://localhost:3306/lab_jsp";
            Connection con = DriverManager.getConnection(url,"root","");
            Statement stmt = con.createStatement();
            String sql1  = "UPDATE student SET (name,branch,semester,rollno) VALUES ('"+name+"','"+branch+"','"+sam+"','"+rollno+"')";
            int rs = stmt.executeUpdate(sql1);
            
          }
        catch(Exception e)
          {
            e.printStackTrace();
          }
        %>
    </body>
</html>
